#include <cstdio>
#include "Rational.h"

void checkingDouble(Rational i) {
	printf("Checking double(i)...\n");
	printf("%d/%d=%f\n",i.quotient,i.divisor,(double)i);
}

void CheckingPostPP(Rational i) {
	printf("Checking i++...\n");
	printf("before: i=%d/%d\n",i.quotient,i.divisor);
	Rational j=i++;
	printf("after: j=i++;\nj=%d/%d\n",j.quotient,j.divisor);
	printf("i=%d/%d\n",i.quotient,i.divisor);
}

void CheckingPrePP(Rational i) {
	printf("Checking ++i...\n");
	printf("before: i=%d/%d\n",i.quotient,i.divisor);
	Rational j=++i;
	printf("after: j=++i;\nj=%d/%d\n",j.quotient,j.divisor);
	printf("i=%d/%d\n",i.quotient,i.divisor);
}

void CheckingPostMM(Rational i) {
	printf("Checking i--...\n");
	printf("before: i=%d/%d\n",i.quotient,i.divisor);
	Rational j=i--;
	printf("after: j=i--;\nj=%d/%d\n",j.quotient,j.divisor);
	printf("i=%d/%d\n",i.quotient,i.divisor);
}

void CheckingPreMM(Rational i) {
	printf("Checking --i...\n");
	printf("before: i=%d/%d\n",i.quotient,i.divisor);
	Rational j=--i;
	printf("after: j=--i;\nj=%d/%d\n",j.quotient,j.divisor);
	printf("i=%d/%d\n",i.quotient,i.divisor);
}

int main () {
	Rational a;
	Rational b(10,12);
	Rational c(12);
	Rational d(22,47);
	Rational e=b+c;
	Rational f(d-b);
	Rational g=d/b;
	Rational h(b*d);
	Rational i(18,12);
	Rational j(3,2);
	Rational k(g);
	Rational l(33);
	i*=h;
	j+=i;
	k-=j;
	l/=k;
	CheckingPostPP(k);
	CheckingPrePP(k);
	CheckingPostMM(k);
	CheckingPreMM(k);
	checkingDouble(k);
	printf("a=%d/%d\n",a.quotient,a.divisor);
	printf("b=%d/%d\n",b.quotient,b.divisor);
	printf("c=%d/%d\n",c.quotient,c.divisor);
	printf("d=%d/%d\n",d.quotient,d.divisor);
	printf("e=%d/%d\n",e.quotient,e.divisor);
	printf("f=%d/%d\n",f.quotient,f.divisor);
	printf("g=%d/%d\n",g.quotient,g.divisor);
	printf("h=%d/%d\n",h.quotient,h.divisor);
	printf("i=%d/%d\n",i.quotient,i.divisor);
	printf("j=%d/%d\n",j.quotient,j.divisor);
	printf("k=%d/%d\n",k.quotient,k.divisor);
	printf("l=%d/%d\n",l.quotient,l.divisor);
	printf("Checking <...\n");	
	if (k<l) printf("%d/%d < %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	else printf("%d/%d >= %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	printf("Checking >=...\n");
	if (k>=l) printf("%d/%d >= %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	else printf("%d/%d < %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	printf("Checking <=...\n");	
	if (k<=l) printf("%d/%d <= %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	else printf("%d/%d > %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	printf("Checking >...\n");	
	if (k>l) printf("%d/%d > %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	else printf("%d/%d <= %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	l=k;
	k=b;
	printf("Checking <...\n");
	if (k<l) printf("%d/%d < %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	else printf("%d/%d >= %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	printf("Checking >=...\n");
	if (k>=l) printf("%d/%d >= %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	else printf("%d/%d < %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	printf("Checking <=...\n");	
	if (k<=l) printf("%d/%d <= %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	else printf("%d/%d > %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	printf("Checking >...\n");	
	if (k>l) printf("%d/%d > %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	else printf("%d/%d <= %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	printf("Checking !=...\n");
	if (k!=l) printf("%d/%d != %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	else printf("%d/%d == %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	printf("Checking ==...\n");
	if (k==l) printf("%d/%d == %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	else printf("%d/%d != %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	k=l;
	printf("Checking !=...\n");
	if (k!=l) printf("%d/%d != %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	else printf("%d/%d == %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	printf("Checking ==...\n");
	if (k==l) printf("%d/%d == %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
	else printf("%d/%d != %d/%d\n",k.quotient,k.divisor,
					l.quotient,l.divisor);
}
